import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { defHttp } from '/@/utils/http/axios';
import { UploadTypeEnum } from '/@/components/Form/src/jeecg/components/JUpload';
import { render, formattingMin, formattingDay, formatTimestamp } from '/@/utils/common/renderUtils';

//表单数据--拼车发起
export const formSchemaUpCarAddress : FormSchema[] = [
	{
		label: '',
		field: 'mainId',
		component: 'Input',
		show: false
	},
	{
		label: '',
		field: 'orderId',
		component: 'Input',
		show: false
	},
	{
		label: '上车地点',
		field: 'toAddressId',
		component: 'ApiSelect',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请选择上车地点!' },
			];
		},
		componentProps: ({ formActionType, formModel }) => {
			if (formModel.mainId && formModel.mainId != 'undefined' && formModel.mainId != undefined) {
				return {
					//multiple: 多选；不填写为单选
					mode: '',
					//根据大团id获取上车地点
					//请求api,返回结果{ result: { records: [{'id':'1',name:'scott'},{'id':'2',name:'小张'}] }}
					api: () => defHttp.get({ url: '/journey/bsTravelgroupMaintuortravellinerecord/getUpCarAddressById?id=' + formModel.mainId }),
					//数值转成String
					numberToString: false,
					//标题字段
					labelField: 'shortAddress',
					//值字段
					valueField: 'upCatPointId',
					//请求参数
					params: {
						//carpoolBus: formModel.carpoolBus
					},
					//返回结果字段
					resultField: 'records'
				}
			}
		},
	},
];

export const formSchemaCombinedUpCarAddress : FormSchema[] = [
	{
		label: '',
		field: 'mainId',
		component: 'Input',
		show: false
	},
	{
		label: '',
		field: 'addressId',
		component: 'Input',
		show: false
	},
	
	{
		label: '上车地点',
		field: 'toAddressId',
		component: 'ApiSelect',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请选择上车地点!' },
			];
		},
		componentProps: ({ formActionType, formModel }) => {
			if (formModel.mainId && formModel.mainId != 'undefined' && formModel.mainId != undefined) {
				return {
					//multiple: 多选；不填写为单选
					mode: '',
					//根据大团id获取上车地点
					//请求api,返回结果{ result: { records: [{'id':'1',name:'scott'},{'id':'2',name:'小张'}] }}
					api: () => defHttp.get({ url: '/journey/bsTravelgroupMaintuortravellinerecord/getUpCarAddressById?id=' + formModel.mainId }),
					//数值转成String
					numberToString: false,
					//标题字段
					labelField: 'shortAddress',
					//值字段
					valueField: 'upCatPointId',
					//请求参数
					params: {
						//carpoolBus: formModel.carpoolBus
					},
					//返回结果字段
					resultField: 'records'
				}
			}
		},
	},
];

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData) : FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}